//
// Created by Administrator on 2022/7/7.
//
#include "Tree.cpp"
//计算非叶子结点
//采用递归的思想，当结点为空和是叶子结点时，退出递归，否则非叶子节点的总数目就等于左子树的非叶子节点数加柚子树的非叶子结点数加1
int count(Tree root){
    if(root==NULL){
        return 0;
    }
    else if(root->leftChild==NULL&&root->rightChild==NULL){
        return 0;
    }
    else{
        return 1+count(root->rightChild)+count(root->leftChild);
    }
}
int main(){
    Tree tree= CreateTreeByFile("Day-614-1.txt");
    printf("%d",count(tree));
}